package com.ang.aop.controller;

import com.ang.aop.annotation.SysAuthDemo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestSysAuthDemoController {

    @SysAuthDemo(hasAuth = "list")
    @RequestMapping("hasListAuth")
    public void hasListAuth(){
        //在OptLogAspect的Aspect中设置了controller的切点，会有其他通知打印出来
        System.out.println("-------------------------");
        System.out.println("看到这句话，表示拥有list权限");
        System.out.println("-------------------------");
    }

    @SysAuthDemo(hasAuth = "delete")
    @RequestMapping("hasDeleteAuth")
    public void hasDeleteAuth(){
        //在OptLogAspect的Aspect中设置了controller的切点，会有其他通知打印出来
        System.out.println("-------------------------");
        System.out.println("看到这句话，表示拥有delete权限");
        System.out.println("-------------------------");
    }

    @SysAuthDemo(hasRole = "user")
    @RequestMapping("hasUserRole")
    public void hasUserRole(){
        //在OptLogAspect的Aspect中设置了controller的切点，会有其他通知打印出来
        System.out.println("-------------------------");
        System.out.println("看到这句话，表示拥有user角色");
        System.out.println("-------------------------");
    }

    @SysAuthDemo(hasRole = "admin")
    @RequestMapping("hasAdminRole")
    public void hasAdminRole(){
        //在OptLogAspect的Aspect中设置了controller的切点，会有其他通知打印出来
        System.out.println("-------------------------");
        System.out.println("看到这句话，表示拥有admin角色");
        System.out.println("-------------------------");
    }
}
